package com.example.administrator.xiaoxiang.fragment;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.ProgressBar;

import com.example.administrator.xiaoxiang.R;
import com.example.administrator.xiaoxiang.url.URLResource;

/**
 * A simple {@link Fragment} subclass.
 */
public class ChoiceFragment extends Fragment {
    public static final String TAG = "ChoiceFragment";
    private WebView webView;
    private ProgressBar progressBar;
    public ChoiceFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.activity_movie,container,false);
        init(view);
        return view;
    }

    private void init(View view) {
        progressBar = new ProgressBar(getContext());
        webView = (WebView) view.findViewById(R.id.webview_movie_activity);
        progressBar.setProgress(100);

//        settings.setDomStorageEnabled(true);
//        webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);//设置js可以直接打开窗口，如window.open()，默认为false
        webView.getSettings().setJavaScriptEnabled(true);//是否允许执行js，默认为false。设置true时，会提醒可能造成XSS漏洞
//        webView.getSettings().setSupportZoom(true);//是否可以缩放，默认true
//        webView.getSettings().setBuiltInZoomControls(true);//是否显示缩放按钮，默认false
//        webView.getSettings().setUseWideViewPort(true);//设置此属性，可任意比例缩放。大视图模式
//        webView.getSettings().setLoadWithOverviewMode(true);//和setUseWideViewPort(true)一起解决网页自适应问题
//        webView.getSettings().setAppCacheEnabled(true);//是否使用缓存
//        webView.getSettings().setDomStorageEnabled(true);//DOM Storage
        webView.loadUrl(URLResource.Read);
    }

}
